package game.leon.war.node.service;

import game.leon.war.node.meta.Battle;
import game.leon.war.node.meta.Fighter;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * User: bianpeng
 * Date: 12-1-31
 */
@Component
public class BattleService {
    private Map<Long, Battle> liveBattles = new HashMap<Long, Battle>();
    public Battle createBattle(long striker, long counter) {
        Battle battle = new Battle(striker, counter);
        // striker
        Fighter a = new Fighter();
        a.setId(1001);
        a.setSeat(111);
        a.setName("路飞");
        Fighter b = new Fighter();
        b.setId(1002);
        b.setSeat(112);
        b.setName("乔巴");
        // counter
        Fighter c = new Fighter();
        c.setId(2001);
        c.setSeat(211);
        c.setName("小丑");
        battle.setFighters(new Fighter[]{
                a, b, c
        });
        liveBattles.put(striker, battle);
        return battle;
    }
}
